// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/base/api/DashboardGoldApi'

import InfoClass from '@api/base/model/GoldDeviceVideoPieReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 信息 —————————————————————————————— //

  async getInfo(param, TIP = '查询设备统计') {
    const DTO = CORE.grpcDTO(InfoClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'goldDeviceVideoPie', DTO)
    return resp.deviceTypeList || []
  },
  transInfo(arr) {
    const list = arr.map((item) => [item.deviceTypeId, item.deviceTypeName, item.online, item.offline, item.fault])
    return { list }
  },
}
